﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using CarShop.Domain.Entities;

namespace CarShop.Domain.Interfaces
{
    public interface IRepository<TEntity, in TKey> 
        where TEntity : EntityBase<TKey>
        where TKey : struct
    {
        TEntity Get(TKey id);

        IQueryable<TEntity> GetAll(params string[] includes);
        IQueryable<TEntity> GetByPredicate(Func<TEntity, bool> predicate, params string[] includes);

        IEnumerable<TEntity> GetPaged<TProperty>(Func<TEntity, bool> predicate, int pageIndex, int pageSize, out int totalPages,
                                                 Expression<Func<TEntity, TProperty>> orderByExpression, bool ascending = true, params string[] includes);

        void Add(TEntity entity);

        void Update(TEntity entity);

        void Delete(TEntity entity);

        void Delete(TKey id);
    }
}
